/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sklepik;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author student
 */
public class DbListMenager extends DbAbstractMenager {

    protected List<User> users = new LinkedList<User>();
    protected List<Order> orders = new ArrayList<Order>();
    private List<Product> products;

    @Override
    public void addUser(User u) {
        users.add(u);

    }

    @Override
    public void addOrder(Order adr) {
        orders.add(adr);

    }

    @Override
    public User findUser(Long id) {
        if (id> users.size()) {
            return null;
        } else {
            return users.get(id.intValue());
        }
    }

    @Override
    public Order findOrder(Long id) {
        if (id < 0 || id >= orders.size()) {
            return null;
        } else {
            return orders.get(id.intValue());
        }
    }
}
